<template>
	<view class="page">
		<pageTxt>
			<!--  v-model="dataList" @query="queryList" -->
			<z-paging ref="paging" refresher-only @onRefresh="onRefresh"
				:paging-style="{ 'background-color': '#f7f7f7', height: '100%', width: '100%' }">
				<!-- 头部 -->
				<template slot="top">
					<u-navbar title="售后详情" :autoBack="true" :fixed="false"></u-navbar>
					<view class="tab-box">
						<u-tabs :current="tabIndex" @click="tabClickFunc" :list="tablist" inactiveStyle="color: #919092;"
							activeStyle="color: #3B75FF;" lineColor="#3B75FF"></u-tabs>
					</view>
				</template>
				<!-- 内容 -->
				<view class="detail-content-box" v-if="asInfo">
					<template v-if="tabIndex == 0">
						<u-empty v-if="!$fieldShowFunc('25-xmxx') && !$fieldShowFunc('25-shxx')" marginTop="300rpx"
							icon="https://hzybucket.obs.cn-south-1.myhuaweicloud.com/we_chat/no-msg2.png" text=" "></u-empty>
						<view class="item-box" v-if="$fieldShowFunc('25-xmxx')">
							<view class="title">项目信息</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_xmmc')">
								<text class="txt">项目名称</text>
								<view class="content">
									{{ asInfo.project_name || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_xmbh')">
								<text class="txt">项目编号</text>
								<view class="content flex ac">
									<text class="txt-btn" @click="navToProjectFunc">
										{{ asInfo.project_number || '--' }}
									</text>
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_xmpp')">
								<text class="txt">项目品牌</text>
								<view class="content flex ac">
									{{ asInfo.brand_name || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_xmlx')">
								<text class="txt">项目类型</text>
								<view class="content flex ac flex">
									{{ asInfo.store_type_name || '--' }}
								</view>
							</view>
						</view>
						<view class="item-box" v-if="$fieldShowFunc('25-shxx')">
							<view class="tips-box">
								<view class="title">售后信息</view>
								<u-tag color="#FFAC3B" borderColor="rgba(0,0,0,0)" bgColor="rgba(255, 172, 59, .15)" text="待处理"
									size="mini" v-if="asInfo.after_sales_status == 10"></u-tag>
								<u-tag color="#3B75FF" borderColor="rgba(0,0,0,0)" bgColor="rgba(59, 117, 255, .15)" text="已完成"
									size="mini" v-else-if="asInfo.after_sales_status == 60"></u-tag>
								<u-tag color="#34B325" borderColor="rgba(0,0,0,0)" bgColor="rgba(52, 179, 37, .15)" text="进行中"
									size="mini" v-else></u-tag>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shgdbh')">
								<text class="txt">售后工单编号</text>
								<view class="content">
									{{ asInfo.after_sales_number }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_qwsmsj')">
								<text class="txt">期望上门时间</text>
								<view class="content flex ac">
									{{ asInfo.expected_doorstep_time || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_xcdjdh')">
								<text class="txt">现场对接电话</text>
								<view class="content" @click="$callPhone(asInfo.scene_phone)">
									<text class="iconfont icon-dianhua"></text>
									{{ asInfo.scene_phone || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shjzrq')">
								<text class="txt">售后截止日期</text>
								<view class="content flex ac flex">
									{{ asInfo.warranty_deadline_date || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_sfzzbqn')">
								<text class="txt">是否质保期内</text>
								<view class="content flex ac flex">
									{{ asInfo.is_sell_by == 1 ? '是' : '否' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_fqr')">
								<text class="txt">发起人</text>
								<view class="content flex ac flex">
									{{ asInfo.user_name || '--' }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_gcjl')">
								<text class="txt">工程监理</text>
								<view class="content flex ac flex">
									{{ asInfo.engineering_supervision_name || '--' }}
								</view>
							</view>

							<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_tpsp')">
								<text class="txt">图片/视频</text>
								<view class="content flex ac flex">
									<image v-for="(item, idx) in asInfo.after_sales_attachments" :key="idx" :src="$fileImgFunc(item)"
										@click="previewFunc(item)" mode="aspectFill" class="img-box"></image>
									<template v-if="!asInfo.after_sales_attachments.length">--</template>
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_cjsj')">
								<text class="txt">创建时间</text>
								<view class="content flex ac flex">
									{{ asInfo.created_at }}
								</view>
							</view>
							<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shnr')">
								<text class="txt">售后内容</text>
								<view class="content flex ac flex">
									{{ asInfo.problem_content || '--' }}
								</view>
							</view>
						</view>
						<template v-if="asInfo.after_sales_status > 30">
							<view class="item-box" v-if="$fieldShowFunc('25-xcfk')">
								<view class="title">现场反馈</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_sfxycjdh')">
									<text class="txt">是否需要集采</text>
									<view class="content">{{ asInfo.is_order_goods == 1 ? '是' : '否' }}</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shxchszp')">
									<text class="txt">现场核实照片</text>
									<view class="content flex ac flex">
										<image v-for="(item, idx) in asInfo.on_site_verification" :key="idx" :src="$fileImgFunc(item)"
											@click="previewFunc(item)" mode="aspectFill" class="img-box"></image>
										<template v-if="!asInfo.on_site_verification.length">--</template>
									</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shdcsj')">
									<text class="txt">到场时间</text>
									<view class="content">{{ asInfo.feedback_at || '--' }}</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shdcry')">
									<text class="txt">到场人员</text>
									<view class="content">{{ asInfo.foreman_name || '--' }}</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shdhxqmx')">
									<text class="txt">订货需求(明细)</text>
									<view class="content">{{ asInfo.order_demand || '--' }}</view>
								</view>
							</view>
						</template>

						<template v-if="asInfo.after_sales_status > 40">
							<view class="item-box" v-if="$fieldShowFunc('25-clxq')">
								<view class="title">处理详情</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shsggcjl')">
									<text class="txt">施工工程经理</text>
									<view class="content">{{ asInfo.engineering_manager_name || '--' }}</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_wxgcjl')">
									<text class="txt">维修工程经理</text>
									<view class="content">{{ asInfo.repair_engineering_manager_name || '--' }}</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_xqzgsj')">
									<text class="txt">限期整改日期</text>
									<view class="content">{{ asInfo.deadline_date || '--' }}</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shzrpd')">
									<text class="txt">售后责任判定</text>
									<view class="content">{{ asInfo.responsible_party }}</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shlxhf')">
									<text class="txt">售后类型划分</text>
									<view class="content">{{ asInfo.problem_type }}</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shshfy')">
									<text class="txt">售后费用</text>
									<view class="content">{{ asInfo.after_sales_expenses ? `${asInfo.after_sales_expenses}元` : '--' }}
									</view>
								</view>
								<u-collapse accordion v-if="$fieldShowFunc('sh_shsgf')" :border="false" value="sgf">
									<u-collapse-item title="施工费" name="sgf"
										:isLink="$fieldShowFunc('sh_shclf') || $fieldShowFunc('sh_shrgf')"
										:value="asInfo.construction_cost ? `${asInfo.construction_cost}元` : '--'">
										<view class="item-child-box" v-if="$fieldShowFunc('sh_shclf') || $fieldShowFunc('sh_shrgf')">
											<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shclf')">
												<text class="txt">材料费</text>
												<view class="content">{{ asInfo.material_cost ? `${asInfo.material_cost}元` : '--' }}</view>
											</view>
											<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shrgf')">
												<text class="txt">人工费</text>
												<view class="content">{{ asInfo.labor_cost ? `${asInfo.labor_cost}元` : '--' }}</view>
											</view>
										</view>
									</u-collapse-item>
								</u-collapse>

								<u-collapse accordion v-if="$fieldShowFunc('sh_shjcf')" :border="false" value="jcf">
									<u-collapse-item title="集采费" name="jcf"
										:isLink="$fieldShowFunc('sh_shdhrq') || $fieldShowFunc('sh_shdhrq2') || $fieldShowFunc('sh_shcgzy') || $fieldShowFunc('sh_shwldh')"
										:value="asInfo.total_price ? `${asInfo.total_price}元` : '--'">
										<view class="item-child-box"
											v-if="$fieldShowFunc('sh_shdhrq') || $fieldShowFunc('sh_shdhrq2') || $fieldShowFunc('sh_shcgzy') || $fieldShowFunc('sh_shwldh')">
											<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shdhrq')">
												<text class="txt">订货日期</text>
												<view class="content">{{ asInfo.order_time || '--' }}</view>
											</view>
											<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shdhrq2')">
												<text class="txt">到货日期</text>
												<view class="content">{{ asInfo.actual_arrival_time || '--' }}</view>
											</view>
											<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shcgzy')">
												<text class="txt">采购专员</text>
												<view class="content">{{ asInfo.name || '--' }}</view>
											</view>
											<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shwldh')">
												<text class="txt">物流单号</text>
												<view class="content">{{ asInfo.odd_numbers || '--' }}</view>
											</view>
										</view>
									</u-collapse-item>
								</u-collapse>

								<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shshwcrq')">
									<text class="txt">售后完成日期</text>
									<view class="content">{{ asInfo.completion_date || '--' }}</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shsx')">
									<text class="txt">售后时效</text>
									<view class="content">{{ asInfo.after_sales_timeliness }}天</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shwczpsp')">
									<text class="txt">完成照片/视频</text>
									<view class="content flex ac flex">
										<image v-for="(item, idx) in asInfo.completed_on_site" :key="idx" :src="$fileImgFunc(item)"
											@click="previewFunc(item)" mode="aspectFill" class="img-box"></image>
										<template v-if="!asInfo.completed_on_site.length">--</template>
									</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shwxfyje')">
									<text class="txt">维修费用金额</text>
									<view class="content">{{ asInfo.construction_cost ? `${asInfo.construction_cost}元` : '--' }}</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shwxfyqd')">
									<text class="txt">维修费用清单</text>
									<view class="content flex ac flex">
										<image v-for="(item, idx) in asInfo.cost_list" :key="idx" :src="$fileImgFunc(item)"
											@click="previewFunc(item)" mode="aspectFill" class="img-box"></image>
										<template v-if="!asInfo.cost_list.length">--</template>
									</view>
								</view>
								<view class="item-box-item flex jb" v-if="$fieldShowFunc('sh_shbzsm')">
									<text class="txt">备注说明</text>
									<view class="content">{{ asInfo.remark || '--' }}</view>
								</view>
							</view>
						</template>
					</template>
					<template v-if="tabIndex == 1">
						<view class="item-box">
							<u-empty v-if="!asInfo.log_list.length" marginTop="300rpx"
								icon="https://hzybucket.obs.cn-south-1.myhuaweicloud.com/we_chat/no-msg2.png" text=" "></u-empty>
							<u-steps current="0" direction="column" dot activeColor="#3b75ff" inactiveColor="#3b75ff">
								<u-steps-item v-for="(item, index) in asInfo.log_list" :key="index">
									<template slot="desc">
										<view class="steps-title flex ac jb">
											<view class="steps-title-title">{{ item.updated_at }}</view>
											<view class="steps-title-user-data-box flex ac jc">
												<image class="avater-box" :src="item.handlers_image" mode="aspectFit"></image>
												<view class="user-name u-line-1">
													{{ item.handlers_name + '-' + item.handlers_position }}
												</view>
											</view>
										</view>
										<view class="steps-desc">
											<view class="steps-desc-title">
												{{ item.content }}
											</view>
											<template v-if="item.after_sales_status == 10">
												<view class="steps-desc-box flex ac" v-if="$fieldShowFunc('sh_qwsmsj')">
													<view class="steps-desc-box-title">期望上门时间</view>
													<view class="steps-desc-box-desc">
														{{ item.form_data.expected_doorstep_time }}
													</view>
												</view>
												<view class="steps-desc-box flex ac" v-if="$fieldShowFunc('sh_xcdjdh')">
													<view class="steps-desc-box-title">现场对接电话</view>
													<view class="steps-desc-box-desc">{{ item.form_data.scene_phone }}</view>
												</view>
												<view class="steps-desc-box flex ac" v-if="$fieldShowFunc('sh_shnr')">
													<view class="steps-desc-box-title">售后内容</view>
													<view class="steps-desc-box-desc">
														{{ item.form_data.problem_content }}
													</view>
												</view>
												<view class="steps-desc-box flex ac" v-if="$fieldShowFunc('sh_tpsp')">
													<view class="steps-desc-box-title">图片/视频</view>
													<view class="steps-desc-box-desc flex ac flex-wrap">
														<image @click="previewFunc(file)" class="img-box"
															v-for="(file, fileIndex) in item.form_data.after_sales_file" :key="fileIndex"
															:src="$fileImgFunc(file)"></image>
													</view>
												</view>
											</template>
											<template v-if="item.after_sales_status == 20">
												<view class="steps-desc-box flex ac" v-if="$fieldShowFunc('sh_qwsmsj')">
													<view class="steps-desc-box-title">期望上门时间</view>
													<view class="steps-desc-box-desc">
														{{ item.form_data.expected_doorstep_time }}
													</view>
												</view>
												<view class="steps-desc-box flex ac" v-if="$fieldShowFunc('sh_xcdjdh')">
													<view class="steps-desc-box-title">现场对接电话</view>
													<view class="steps-desc-box-desc">{{ item.form_data.scene_phone }}</view>
												</view>
												<view class="steps-desc-box flex ac" v-if="$fieldShowFunc('sh_gcjl')">
													<view class="steps-desc-box-title">工程监理</view>
													<view class="steps-desc-box-desc">
														{{ item.form_data.engineering_supervision_name }}
													</view>
												</view>
												<view class="steps-desc-box flex ac" v-if="$fieldShowFunc('sh_shnr')">
													<view class="steps-desc-box-title">售后内容</view>
													<view class="steps-desc-box-desc">
														{{ item.form_data.problem_content }}
													</view>
												</view>
												<view class="steps-desc-box" v-if="$fieldShowFunc('sh_tpsp')">
													<view class="steps-desc-box-title">图片/视频</view>
													<view class="steps-desc-box-desc flex ac flex-wrap">
														<image @click="previewFunc(file)" class="img-box"
															v-for="(file, fileIndex) in item.form_data.after_sales_file" :key="fileIndex"
															:src="$fileImgFunc(file)"></image>
														<template v-if="item.form_data.after_sales_file.length == 0">--</template>
													</view>
												</view>
											</template>
											<template v-if="item.after_sales_status == 30 && asInfo.user_position == '工程监理'">
												<view class="steps-desc-box flex ac"
													v-if="$fieldShowFunc('sh_shsggcjl') || $fieldShowFunc('sh_wxgcjl')">
													<view class="steps-desc-box-title">工程经理</view>
													<view class="steps-desc-box-desc">
														{{ asInfo.repair_engineering_manager_name }}
													</view>
												</view>
												<view class="steps-desc-box flex ac" v-if="$fieldShowFunc('sh_shnr')">
													<view class="steps-desc-box-title">售后内容</view>
													<view class="steps-desc-box-desc">{{ asInfo.problem_content }}</view>
												</view>
												<view class="steps-desc-box" v-if="$fieldShowFunc('sh_tpsp')">
													<view class="steps-desc-box-title">图片/视频</view>
													<view class="steps-desc-box-desc flex ac flex-wrap">
														<template v-for="(file, fileIndex) in asInfo.after_sales_attachments">
															<image @click="previewFunc(file)" class="img-box" :key="fileIndex"
																:src="$fileImgFunc(file)" v-if="file.type == 1"></image>
														</template>
														<template v-if="asInfo.after_sales_attachments.length == 0">--</template>
													</view>
												</view>
											</template>
											<template v-if="item.after_sales_status == 40">
												<view class="steps-desc-box flex ac" v-if="$fieldShowFunc('sh_sfxycjdh')">
													<view class="steps-desc-box-title">是否需要集采</view>
													<view class="steps-desc-box-desc">
														{{ item.form_data.is_order_goods == 1 ? '是' : '否' }}
													</view>
												</view>
												<view class="steps-desc-box flex ac" v-if="$fieldShowFunc('sh_shdhxqmx')">
													<view class="steps-desc-box-title">订货需求(明细)</view>
													<view class="steps-desc-box-desc">
														{{ item.form_data.order_demand || '--' }}
													</view>
												</view>
												<view class="steps-desc-box" v-if="$fieldShowFunc('sh_shxchszp')">
													<view class="steps-desc-box-title">现场核实照片</view>
													<view class="steps-desc-box-desc flex ac flex-wrap">
														<template v-for="(file, fileIndex) in item.form_data.site_file">
															<image @click="previewFunc(file)" class="img-box" :key="fileIndex"
																:src="$fileImgFunc(file)"></image>
														</template>
														<template v-if="item.form_data.site_file.length == 0">--</template>
													</view>
												</view>
											</template>
											<template v-if="item.after_sales_status == 50">
												<view class="steps-desc-box flex ac" v-if="$fieldShowFunc('sh_shlxhf')">
													<view class="steps-desc-box-title">售后类型划分</view>
													<view class="steps-desc-box-desc">{{ item.form_data.problem_type }}</view>
												</view>
												<view class="steps-desc-box flex ac" v-if="$fieldShowFunc('sh_shxqzgrq')">
													<view class="steps-desc-box-title">限期整改日期</view>
													<view class="steps-desc-box-desc">{{ item.form_data.deadline_date }}</view>
												</view>
												<view class="steps-desc-box flex ac" v-if="$fieldShowFunc('sh_shzrpd')">
													<view class="steps-desc-box-title">售后责任判定</view>
													<view class="steps-desc-box-desc">
														{{ item.form_data.responsible_party }}
													</view>
												</view>
												<view class="steps-desc-box flex ac" v-if="$fieldShowFunc('sh_shclf')">
													<view class="steps-desc-box-title">材料费</view>
													<view class="steps-desc-box-desc">{{ item.form_data.material_cost }}元</view>
												</view>
												<view class="steps-desc-box flex ac" v-if="$fieldShowFunc('sh_shrgf')">
													<view class="steps-desc-box-title">人工费</view>
													<view class="steps-desc-box-desc">{{ item.form_data.labor_cost }}元</view>
												</view>
												<view class="steps-desc-box flex ac" v-if="$fieldShowFunc('sh_shsgf')">
													<view class="steps-desc-box-title">施工费</view>
													<view class="steps-desc-box-desc">{{ item.form_data.construction_cost }}元</view>
												</view>
												<template v-if="asInfo.is_order_goods == 1">
													<view class="steps-desc-box flex ac" v-if="$fieldShowFunc('sh_shdhrq')">
														<view class="steps-desc-box-title">订货日期</view>
														<view class="steps-desc-box-desc">
															{{ asInfo.order_time || '--' }}
														</view>
													</view>
													<view class="steps-desc-box flex ac" v-if="$fieldShowFunc('sh_shdhrq2')">
														<view class="steps-desc-box-title">到货日期</view>
														<view class="steps-desc-box-desc">
															{{ asInfo.actual_arrival_time || '--' }}
														</view>
													</view>
													<view class="steps-desc-box flex ac" v-if="$fieldShowFunc('sh_shcgzy')">
														<view class="steps-desc-box-title">采购专员</view>
														<view class="steps-desc-box-desc">{{ asInfo.name || '--' }}</view>
													</view>
													<view class="steps-desc-box flex ac" v-if="$fieldShowFunc('sh_shwldh')">
														<view class="steps-desc-box-title">物流单号</view>
														<view class="steps-desc-box-desc">
															{{ asInfo.odd_numbers || '--' }}
														</view>
													</view>
												</template>
												<view class="steps-desc-box" v-if="$fieldShowFunc('sh_shwxfyqd')">
													<view class="steps-desc-box-title">维修费用清单</view>
													<view class="steps-desc-box-desc flex ac flex-wrap">
														<template v-for="(file, fileIndex) in item.form_data.cost_file">
															<image @click="previewFunc(file)" class="img-box" :key="fileIndex"
																:src="$fileImgFunc(file)"></image>
														</template>
														<template v-if="item.form_data.cost_file.length == 0">--</template>
													</view>
												</view>
												<view class="steps-desc-box flex ac" v-if="$fieldShowFunc('gc_shbzsm')">
													<view class="steps-desc-box-title">备注</view>
													<view class="steps-desc-box-desc">
														{{ item.form_data.remark || '--' }}
													</view>
												</view>
											</template>
											<template v-if="item.after_sales_status == 60">
												<view class="steps-desc-box" v-if="$fieldShowFunc('sh_shwczpsp')">
													<view class="steps-desc-box-title">完成照片/视频</view>
													<view class="steps-desc-box-desc flex ac flex-wrap">
														<template v-for="(file, fileIndex) in item.form_data.completion_file">
															<image @click="previewFunc(file)" class="img-box" :key="fileIndex"
																:src="$fileImgFunc(file)"></image>
														</template>
														<template v-if="item.form_data.completion_file.length == 0">--</template>
													</view>
												</view>
											</template>
										</view>
									</template>
								</u-steps-item>
							</u-steps>
						</view>
					</template>
				</view>
				<view class="bottom-btn-box flex ac jb" slot="bottom">
					<view style="width: 100%">
						<judgeBtn v-if="!loading" info unborder :per_arr="per_arr" :btns="btns" :state="asInfo.after_sales_status"
							:item="asInfo" @change="btnsChange"></judgeBtn>
					</view>
				</view>
			</z-paging>
		</pageTxt>
		<!-- 文件预览 -->
		<preFileCom :fileObj="fileObj" @onFileSuccess="fileObj = ''"></preFileCom>

		<afterSalesManagement :value.sync="per_name" :oper_item="oper_item" @submit="handleSubmit"></afterSalesManagement>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				per_arr: [],
				btns: [{
						per_name: 'afterSales_completeContent',
						state: 10,
						name: '售后内容完善'
					},
					{
						per_name: 'afterSales_engineeringManager',
						state: 20,
						name: '分配工程经理'
					},
					{
						per_name: 'afterSales_feedback',
						state: 30,
						name: '现场反馈'
					},
					{
						per_name: 'afterSales_judge',
						state: 40,
						name: '责任判定'
					},
					{
						per_name: 'afterSales_successImg',
						state: 50,
						name: '上传完成照片'
					}
				],

				fileObj: '',
				loading: true,
				id: '',
				asInfo: '',
				tabIndex: 0,
				tablist: [{
						name: '详情'
					},
					{
						name: '历史记录'
					}
				],

				oper_item: {},
				per_name: ''
			};
		},
		onShow() {
			this.newAfterSalesDetails(this.id);
		},
		onLoad(option) {
			this.id = option.id;

			// 获取权限
			this.$Api
				.getHtmlAuthority({
					path: '/afterSalesManagement'
				})
				.then((res) => {
					console.log(res, 'getHtmlAuthority');
					if (res.code == 200) {
						this.per_arr = res.data.permission;
					}
				});
		},
		methods: {
			onRefresh() {
				this.newAfterSalesDetails(this.asInfo.id);
				this.$refs.paging.complete();
			},
			tabClickFunc(e) {
				this.tabIndex = e.index;
			},
			// 详情
			newAfterSalesDetails(after_sales_id) {
				this.loading = true;
				this.$Apipc
					.newAfterSalesDetails({
						after_sales_id
					})
					.then((res) => {
						console.log(res, '售后详情');
						this.loading = false;
						if (res.code == 200) {
							res.data.log_list.map((item) => {
								item.form_data = item.form_data ? JSON.parse(item.form_data) : {};
							});
							this.asInfo = res.data;
						}
					});
			},
			// 预览
			previewFunc(item) {
				this.fileObj = item;
			},

			// 操作按钮触发点击
			btnsChange(e) {
				console.log(e, 'xxxsww');
				this.oper_item = e.item;
				switch (e.per_name) {
					// 售后内容完善
					case 'afterSales_completeContent':
						this.per_name = e.per_name;
						break;
						// 分配工程经理
					case 'afterSales_engineeringManager':
						this.per_name = e.per_name;
						break;
						// 现场反馈
					case 'afterSales_feedback':
						this.per_name = e.per_name;
						break;
						// 责任判定
					case 'afterSales_judge':
						this.per_name = e.per_name;
						break;
						// 上传完成照片
					case 'afterSales_successImg':
						this.per_name = e.per_name;
						break;
				}
			},

			handleSubmit(type) {
				this.onRefresh();
			},
			// 去详情项目
			navToProjectFunc() {
				uni.navigateTo({
					url: '/pagesB/projectDetail/projectDetail?id=' + this.asInfo.project_id
				});
			}
		}
	};
</script>

<style lang="scss" scoped></style>